<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@page import="java.sql.*" contentType="text/html;charset=UTF-8" %>  
<%@page import="java.util.*"%>  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'checklogin.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
<%
String userid1=new String(request.getParameter("userid"));
String password1=new String(request.getParameter("password"));
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/tosyokannri","root","x5");
Statement stmt=con.createStatement();
String sql="select * from  userinfo where userid='"+userid1+"';";
ResultSet rs=stmt.executeQuery(sql);
if(rs.next())
{String password=new String(rs.getString("password"));
if(password.equals(password1))
{session.setAttribute("userid1",userid1);
response.sendRedirect("jiansuo.jsp");
}
else
{response.sendRedirect("cuowu1.jsp");
}
}
else
{response.sendRedirect("cuowu1.jsp");
}
%>
</body>
</html>
